package osmparser;

import static org.junit.Assert.assertEquals;

import java.util.Map;

import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.MultiLineString;

/**
 *
 */
public class OSMParserTest {

	public OSMParserTest() {
	}

	/**
	 * Test of parse method, of class OSMParser.
	 */
	public void testParse() {

		// assertTrue(mls.equals(osm.getRelations().iterator().next().getPolygon()));
		// assertTrue(found);
	}

	public static void main(String[] args) throws Exception {
		OSMDoc osm = OSMParser.parse("D:/Temp/test.osm");
		Map<String, OSMNode> nodes = osm.getNodes();
		for (String key : nodes.keySet()) {
			System.out.println(nodes.get(key));
		}

		boolean found = false;

		Map<String, OSMWay> ways = osm.getWays();
		for (String key : osm.getWays().keySet()) {
			System.out.println(ways.get(key).toString());
			System.out.println(ways.get(key).getLineString());
			System.out.println(ways.get(key).getWayLength());
		}
//
//		Coordinate c1 = new Coordinate(-35, -9);
//		Coordinate c2 = new Coordinate(-34, -8);
//		Coordinate c3 = new Coordinate(-33, -7);

//		GeometryFactory fac = new GeometryFactory();
//		MultiLineString mls;
//
//		mls = fac.createMultiLineString(new LineString[] {
//				fac.createLineString(new Coordinate[] { c1, c2 }),
//				fac.createLineString(new Coordinate[] { c2, c3 }) });
//
//		System.out.println(mls.toString());
		
		
		
		Map<String, OSMRelation> relations = osm.getRelations();
		for (String key : relations.keySet()){
			for (AbstractNode ele : relations.get(key).getMembers()){
				System.out.println(ele.toString());
			}
		}
		
		
	}
}